package com.guandeng.dubbo.controller;

import com.guandeng.dubbo.factory.Animal;
import com.guandeng.dubbo.factory.AnimalFactory;
import com.guandeng.dubbo.services.DubboService;
import com.guandeng.dubbo.services.Singleton;
import com.guandeng.dubbo.services.impl.DubboImpl;
import com.guandeng.mall.api.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.guandeng.mall.common.api.CommonResult;
import rx.Single;

import java.security.Signature;

/**
 * @author guandeng.fan
 * @date 2022/5/7 10:30
 */
@RestController
public class DubboController {

    @Autowired
    private DubboService dubboService;

    @Autowired
    private AnimalFactory animalFactory;

//    @Autowired
//    private Singleton singleton;

    @org.apache.dubbo.config.annotation.Reference
    HelloService helloService;

    @GetMapping("/dubbo")
    public CommonResult service() {
        String hello = helloService.hello("test");
        return CommonResult.success(hello);
    }

    @GetMapping("/say")
    public CommonResult say(@RequestParam String name) {
        Animal animal = animalFactory.build(name);
        animal.say();
        return CommonResult.success("成功");
    }

    @GetMapping("proxy")
    public CommonResult proxy(){
        BuyTicketImpl
    }
}
